﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Synchros
{
    public class TimeSlot
    {
        public TimeSlot()
        {
            //　初始化空值
            min_LSN = TimeSlot.Empty;
            min_SEQ = TimeSlot.Empty;

            max_LSN = TimeSlot.Empty;
            max_SEQ = TimeSlot.Empty;
        }
        public static byte[] Empty = new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
        public static byte[] Full = new byte[] { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 };
        public static bool IsEmpty(byte[] bsValue)
        {
            if (BitConverter.ToString(bsValue) == "00-00-00-00-00-00-00-00-00-00")
            {
                return true;
            }
            else
            {
                return false;
            }
        }

        private string syncName = null;

        private byte[] min_LSN = null;
        private byte[] min_SEQ = null;

        private byte[] max_LSN = null;
        private byte[] max_SEQ = null;

        public string SyncName
        {
            set { syncName = value; }
            get { return syncName; }
        }

        public byte[] Min_LSN
        {
            set { min_LSN = value; }
            get { return min_LSN; }
        }
        public byte[] Min_SEQ
        {
            set { min_SEQ = value; }
            get { return min_SEQ; }
        }

        public byte[] Max_LSN
        {
            set { max_LSN = value; }
            get { return max_LSN; }
        }
        public byte[] Max_SEQ
        {
            set { max_SEQ = value; }
            get { return max_SEQ; }
        }



        public static string GetLsnSequence(byte[] lsn, byte[] seq)
        {
            return ("0X" + BitConverter.ToString(lsn) + "0X" + BitConverter.ToString(seq)).Replace("-", "");
        }
    }
}     
//public string Max_LsnSequence
//{
//    get
//    {
//        return ("0x" + BitConverter.ToString(max_LSN) + "0x" + BitConverter.ToString(max_SEQ)).Replace("-", ""); 
//    }
//}

//public string Min_LsnSequence
//{
//    get
//    {
//        return ("0x" + BitConverter.ToString(min_LSN) + "0x" + BitConverter.ToString(min_SEQ)).Replace("-", "");
//    }
//}